package tech.aistar.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import tech.aistar.dto.Result;
import tech.aistar.entity.Collect;
import tech.aistar.entity.Completion;

import tech.aistar.service.ICollectService;
import tech.aistar.service.ICompletionService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;


@Controller
@RequestMapping("/compage")
public class CompletionIndexAction {
    @Autowired
    private ICompletionService completion;

    @Autowired
    private ICollectService collectService;
    @RequestMapping("/load")
    public String load(){
        return  "compage";
    }

    @RequestMapping("/que")
    public @ResponseBody Result ansstem(HttpServletRequest request, HttpSession session){

        String s=  request.getParameter("data");
        session.setAttribute("comstems",s);
        return new Result("700","123");
    }
    @RequestMapping("/ans")
    public @ResponseBody Result AnsStem(HttpServletRequest request){
        String stem= request.getParameter("stem");
        System.out.println(stem);
        String a = completion.findstemans(stem);
        return new Result("700","答案",a);
    }




}
